package ch09_;

import java.util.Arrays;

public class Ch9_4 {
	public static void getSubsets(int[] a, int position, boolean display) {
		if (position == a.length - 1) {
			System.out.println(Arrays.toString(a));
		} else {
			int r = a[position];
			getSubsets(a, position + 1, display);
			getSubsets(a, position + 1, !display);
			a[position] = r;
			getSubsets(a, position + 1, display);
			getSubsets(a, position + 1, !display);

		}
	}

	public static void subsets(char[] a, int position) {
		if (position == a.length) {
			System.out.println(Arrays.toString(a));
		} else {
			char r = a[position];
			a[position] = ' ';
			subsets(a, position + 1);
			a[position] = r;
			subsets(a, position + 1);

			/*
			 * subsets(a, position + 1); a[position] = ' '; subsets(a, position
			 * + 1);
			 */
		}
	}

	public static void main(String[] args) {
		int len = 5;
		char[] a = new char[len];
		for (int i = 0; i < len; i++) {
			a[i] = (char) ('a' + i);
		}
		// getSubsets(a, 0, false);
		subsets(a, 0);
	}
}